Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

music-metadata

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

music-metadata

Music metadata parser for Node.js, supporting virtual any audio and tag format.

  • 7.14.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
332K
increased by14.49%
Maintainers
1
Weekly downloads
 
Created

What is music-metadata?

The music-metadata npm package is a powerful tool for parsing and extracting metadata from audio files. It supports a wide range of audio formats and provides detailed information about the audio file, including tags, format, and technical properties.

What are music-metadata's main functionalities?

Extract Basic Metadata

This feature allows you to extract basic metadata from an audio file, such as title, artist, album, and genre. The code sample demonstrates how to use the `parseFile` method to read and log metadata from an MP3 file.

const mm = require('music-metadata');
const fs = require('fs');

async function getMetadata(filePath) {
  try {
    const metadata = await mm.parseFile(filePath);
    console.log(metadata);
  } catch (error) {
    console.error(error.message);
  }
}

getMetadata('path/to/audio/file.mp3');

Extract Format Information

This feature allows you to extract format information from an audio file, such as the container type, codec, sample rate, and bit rate. The code sample demonstrates how to use the `parseFile` method to read and log format information from an MP3 file.

const mm = require('music-metadata');
const fs = require('fs');

async function getFormatInfo(filePath) {
  try {
    const metadata = await mm.parseFile(filePath);
    console.log(metadata.format);
  } catch (error) {
    console.error(error.message);
  }
}

getFormatInfo('path/to/audio/file.mp3');

Extract Technical Properties

This feature allows you to extract technical properties from an audio file, such as duration, number of channels, and bit depth. The code sample demonstrates how to use the `parseFile` method to read and log technical properties from an MP3 file.

const mm = require('music-metadata');
const fs = require('fs');

async function getTechnicalProperties(filePath) {
  try {
    const metadata = await mm.parseFile(filePath);
    console.log(metadata.common);
  } catch (error) {
    console.error(error.message);
  }
}

getTechnicalProperties('path/to/audio/file.mp3');

Other packages similar to music-metadata

Keywords

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc